package com.youxin.cpcenter.common.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class CommonConfigurerAdapter extends WebMvcConfigurerAdapter{
	private static String[]  excludePatterns=new String[]{
			"/api/login"
			,"/api/login/verifycode"
			,"/api/sms/register/code"	
			,"/api/tryout/submit"
			,"/api/ent/identify"
			,"/phone/callback"
			,"/api/weixin/notify"
			,"/api/alipay/notify"
			,"/api/alipay/return"			
			,"/api/classify/onelevel"
			,"/api/citys"
			,"/api/listtypes"
			,"/api/identify/search"
			,"/api/account/tryout/list"
			,"/api/member/info/identify"
			,"/api/member/identify/list"
			
	};
	
	@Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 多个拦截器组成一个拦截器链
        // addPathPatterns 用于添加拦截规则
        // excludePathPatterns 用户排除拦截
		
        registry.addInterceptor(new CustomHandlerInterceptor())
        .addPathPatterns("/api/**")
        .excludePathPatterns(excludePatterns);
        ;
     //   registry.addInterceptor(new MyInterceptor2()).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
